package com.bit.BlogTest.Controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.bit.BlogTest.Model.Blog;
import com.bit.BlogTest.Service.BlogService;

@Controller
@RequestMapping("/blog")
public class BlogController {
	@Autowired
	BlogService blogService;

	@RequestMapping
	public ModelAndView action() {
		
		ModelAndView mnv = new ModelAndView();
		List<Blog> lists = blogService.getAllContents();

		mnv.setViewName("blog");
		mnv.addObject("blog", lists);
		
		return mnv;
	}
}
